package com.example.mapp;

import com.example.entity.ElevatorFileInfo;
import org.apache.ibatis.annotations.*;

/**
 * Created by wang on 2018/3/31.
 */
@Mapper
public interface ElevatorFileInfoMapp {

    @Select(" select * from evelator_file_info  where elevator_num=#{elevatorNum}")
    ElevatorFileInfo queryByElevatorNum(String elevatorNum) throws Exception;

//    @Delete("delete from evelator_file_info where elevator_num=#{elevatorNum}")
//    int deleteById(String id)throws Exception;

    @Insert("insert into evelator_file_info " +
            "(elevator_num,urc,sic,ecp,ml,fttc,cpq,ttgl,ttsl,sctt,bttc,csct,cott,"+
            "dhtt,cctt,sldc,adc,lmrw,es,imm,ipt,inn,cpei,icpr,srei,icdc,iqd,"+
            "pamr,namr,cpam,rcam,sram,crsm,ttsm,dcms,rean,rlp,pqam,ohe,"+
            "oir,pir,diur,dmr,airr,err,rfar,pcsd,"+
            "totalohe)"+

            "values(#{elevatorNum},#{urc},#{sic},#{ecp},#{ml},#{fttc},#{cpq},#{ttgl},#{ttsl},#{sctt},#{bttc},#{csct},#{cott},"+
            "#{dhtt},#{cctt},#{sldc},#{adc},#{lmrw},#{es},#{imm},#{ipt},#{inn},#{cpei},#{icpr},#{srei},#{icdc},#{iqd},"+
            "#{pamr},#{namr},#{cpam},#{rcam},#{sram},#{crsm},#{ttsm},#{dcms},#{rean},#{rlp},#{pqam},#{ohe},"+
            "#{oir},#{pir},#{diur},#{dmr},#{airr},#{err},#{rfar},#{pcsd},"+
            "#{totalohe})")
    @SelectKey(statement = "select last_insert_id()", keyProperty = "id", keyColumn = "id", before = false, resultType = Long.class)
    public Long addElevatorFileInfo(ElevatorFileInfo elevatorFileInfo) throws Exception;

    @Update("update evelator_file_info set urc=#{urc},sic=#{sic},ecp=#{ecp},ml=#{ml},fttc=#{fttc},cpq=#{cpq},ttgl=#{ttgl},ttsl=#{ttsl}," +
            "sctt=#{sctt},bttc=#{bttc},csct=#{csct},cott=#{cott},dhtt=#{dhtt},cctt=#{cctt},sldc=#{sldc},adc=#{adc}," +
            "lmrw=#{lmrw},es=#{es},imm=#{imm},ipt=#{ipt},inn=#{inn},cpei=#{cpei},icpr=#{icpr},srei=#{srei},icdc=#{icdc}," +
            "iqd=#{iqd},pamr=#{pamr},namr=#{namr},cpam=#{cpam},rcam=#{rcam},sram=#{sram},crsm=#{crsm},ttsm=#{ttsm}," +
            "dcms=#{dcms},rean=#{rean},rlp=#{rlp},pqam=#{pqam},ohe=#{ohe},oir=#{oir},pir=#{pir},diur=#{diur}," +
            "dmr=#{dmr},airr=#{airr},err=#{err},rfar=#{rfar},pcsd=#{pcsd},totalohe=#{totalohe}" +
            " where elevator_num=#{elevatorNum}")
    int update(ElevatorFileInfo elevatorFileInfo) throws Exception;
}
